So this is one of my Go models:
type ObjectReference struct {
IRI string `json:"iri" bson:"iri"`
ObjectType string `json:"objectType" bson:"objectType,omitempty"`
ActivityType string `json:"activityType,omitempty" bson:"activityType,omitempty"`
Errors `bson:"-"`
}
I have a validation on the ActivityType as:
objTypeSuccess := o.ObjectType == "activity"
success = success && objTypeSuccess
if (!objTypeSuccess) {
o.errors = append(o.errors, "Object objectType supplied : " + o.ObjectType + " is invalid. Valid object types are : [activity]")
}
where
o *ObjectReference is in the func() definition
I am trying to write a test as so:
testObj = models.ObjectReference{
// Invalid Obj Type
IRI: "http://localhost:8001/launched",
ObjectType: ????,
ActivityType: testObjType,
}
I don't quite understand how I could initialize the ObjectType
in my testObj. Can someone help me with this?